package com.tmt.im.jpa.entity;

import com.tmt.data.jpa.entity.TmtBaseCreator;
import com.tmt.data.jpa.entity.TmtBaseCreatorId;
import com.tmt.data.jpa.entity.TmtBaseEntity;
import com.tmt.data.jpa.entity.TmtBaseEntityId;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;

import java.io.Serial;

/**
 * 个人黑名单表
 *
 * @Description TODO
 * @Author wuyi
 * @Date 2024/8/6 21:11
 * @Version 1.0
 **/
@Getter
@Setter
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "black_bill")
@Tag(name = "black_bill", description = "黑名单表")
public class BlackBill extends TmtBaseEntityId {

    @Serial
    private static final long serialVersionUID = -6946173233138989864L;

    /**
     * 被拉入黑名单的用户
     */
    @ManyToOne(cascade = {CascadeType.REFRESH}, fetch = FetchType.LAZY, optional = false)
    private IMUser user;

    /**
     * 聊天群组ID, 不为空时表示本记录是聊天群组的黑名单.
     */
    @ManyToOne(cascade = {CascadeType.REFRESH}, fetch = FetchType.LAZY)
    private ChatSession session;

    @ManyToOne(cascade = {CascadeType.REFRESH}, fetch = FetchType.LAZY, optional = false)
    private IMUser creator;

}
